package string;

/**
 * boolean matches
 */
public class MatchesDemo {
    public static void main(String[] args) {
        /*
        邮箱正则表达式：
        [a-zA-Z0-9_]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
         */
        String email="2966484783@qq.com";
        String regex="[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        boolean match=email.matches(regex);
        if(match){
            System.out.println("正确的书写格式");
        }else{
            System.out.println("不正确的书写格式");
        }

        String email1="17513571745@dh.com";
        String regex1="[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)";
        boolean match1=email1.matches(regex1);
        if(match1){
            System.out.println("正确");
        }else{
            System.out.println("错误");
        }








        String a="11112334@ssh.com";
        String b="[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        boolean c=a.matches(b);
        if (c){
            System.out.println("对");
        }else{
            System.out.println("错");
        }

    }
}
